<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>充值</title>
</head>
<body>
	<form action="testpay" method="get">
		用户id:<input type="text" id="uid" name="uid" placeholder="9a0883a4aee111eaa0d100163e30f043"><br>
		充值金额:<input type="text" id="money" name="money" placeholder="50.69"> (1RMB = 1YGB)<br> 
		<input type="button" id="submit" onclick="sub()" value="去支付">
	</form>
	<script type="text/javascript">
		// 判断金额是否符合正则表达式
		function sub(){
			var uid = document.getElementById('uid').value;
			var money = document.getElementById('money').value;
			// 金额必须符合  decimal(12,2)
			var pattern = /^([1-9]\d{0,9}|0)([.]?|(\.\d{1,2})?)$/;
			if( ! pattern.test(money) ){
				alert( '请输入正确的金额' );
			}else if( pattern.test(money) ){
				window.location.href='testpay?uid='+uid+'&money='+money+'&return_url='+'paySuccess.html';
			}
		}
		
	</script>
</body>
</html>